package com.my.myTradeData;

import javax.ws.rs.core.MediaType;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
import com.sun.jersey.core.util.MultivaluedMapImpl;

public class VoiceNoteOper {
	  public static final String  LUOSIMAO_SHORTMESSAGE_KEY = "6dcae0b685c13350538f98328ef1ec9d"; //螺丝帽的短信key
	
	/**
     * 短信发送
     * @return
     */
    public static String shortMessageSend() {
        Client client = Client.create();
        client.addFilter(new HTTPBasicAuthFilter("api","key-"+LUOSIMAO_SHORTMESSAGE_KEY));
        WebResource webResource = client.resource("http://sms-api.luosimao.com/v1/send.json");
        MultivaluedMapImpl formData = new MultivaluedMapImpl();
        formData.add("mobile", "13661868241");
        formData.add("message", "您的验证码是666666，在5分钟内有效，如非本人操作请忽略本短信。【卡行天下】");
        ClientResponse response =  webResource.type( MediaType.APPLICATION_FORM_URLENCODED ).
        post(ClientResponse.class, formData);
        String textEntity = response.getEntity(String.class);
        int status = response.getStatus();
        System.out.println(status);
        return "";
    }
    
    public static void main(String args[]){
    	shortMessageSend();
    }
    
}
